package com.example.zhang.controller;

import com.example.zhang.entity.TbUser;
import com.example.zhang.service.TbUserservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.RequestWrapper;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("user")
public class TbUserController {
    @Autowired
    private TbUserservice tbUserService;
    @RequestMapping(value = "/findAll",method = RequestMethod.GET)
    public List<TbUser> finAll(){
        return tbUserService.findAll();
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public String add(@RequestBody TbUser user){
        return tbUserService.add(user);
    }
}
